home *** CD-ROM | disk | FTP | other *** search
- 10 rem *************************
- 20 rem program : runfile 1.0
- 30 rem author : david darus
- 40 rem date : 6/15/87
- 50 rem update : 7/30/87
- 60 rem computer: c64
- 70 rem *************************
- 80 rem command file=1 seq file=2 rel file=3
- 90 rem set up variables
- 98 dn=8
- 100 def fnh(a)=int(a/256):def fnl(a)=a-(rh*256)
- 110 print"[147][154]"chr$(8)chr$(14)
- 140 x=0:y=0:sw=0:c=0:t=0:t1=0:nc=0:hc=0:cc=0:ec=0:a=0:l=0:en=0:tr=0:sc=0:nf=0
- 150 fc=0:nd=0:fl=0:tx=0:ty=0:ox=0:oy=0:nm=0:al=0:ky=0:sp=0:vn=0:tl=0:pl=0:ct=0
- 160 ef=0:mr=0:nl=0:rn=0:nr=0:of=0
- 165 f1=133:f3=134:f5=135:f7=136:f2=137:f4=138:f6=139:f8=140
- 170 rl=0:rh=0:rs=0:re=0:rm=0:ip=0:kf=0:kl=0:kp=0:rp=0:r$="":r1$="":ky$=""
- 180 cm$="":sp$="":a$="":an$="":er$="":dn$="":ss$="":xp$="":yp$=""
- 190 for t=1 to 80:xp$=xp$+"":yp$=yp$+"":sp$=sp$+" ":ul$=ul$+"[164]":next
- 200 ss$=chr$(160):pd$=""
- 210 c=1:hc=2:cc=15:nc=6:ns=6:ec=8:of=0
- 220 nl=22:vn=0:rn=0
- 230 sw=40:mr=1000:ct=0:poke 53280,0:poke 53281,0:poke 808,234:goto 280
- 240 rem sw=40:mr=2000:ct=1:slow:rem trap 21000
- 250 if peek(215)=128 then sw=80:(NULL)%
- 270 (NULL)0,1:(NULL)1,1:(NULL)4,1:(NULL)6,1:(NULL)5,15
- 272 (NULL)1,chr$(133):(NULL)3,chr$(134):(NULL)5,chr$(135):(NULL)7,chr$(136)
- 274 (NULL)2,chr$(137):(NULL)4,chr$(138):(NULL)6,chr$(139):(NULL)8,chr$(140)
- 280 dimcr$(16),cx(nc),cy(nc),cm$(nc),tx$(18),fl$(nl),sx(ns),sy(ns),sm$(ns)
- 290 mf=30:a=mf+1:dim fx(a),fy(a),fl(a),ft(a),ft$(a),fq(a),fo(a)
- 300 dim ix(mr),rd$(mr),si(mr)
- 310 fort=1to16:cr$(t)=mid$("[144][159][156][158][129][149][150][151][152][153][154][155]",t,1):next
- 320 cm$="[195][207][205][205][193][206][196][211]:[154] [195]lose [197]dit [206]ew [207]pen [213]tils e[216]it"
- 330 fort=1 to nc:read cy(t),cx(t),cm$(t):next
- 340 data 23,10,"[195]lose",23,16,"[197]dit",23,21,"[206]ew",23,25,"[207]pen",23,30,"[213]tils"
- 350 data 23,36,"e[216]it"
- 352 sm$="[213][212][201][204][211]:[154] [196]ir [196]os [196]rive#08 [208]rint [211]eq [213]sr"
- 353 for t=1 to ns:read sy(t),sx(t),sm$(t):next
- 354 data 23,7,"[196]ir",23,11,"[196]os",23,15,"[196]rive#08",23,24,"[208]rint",23,30,"[211]eq"
- 355 data 23,34,"[213]sr"
- 360 for t=1 to 18:read tx$(t):next
- 370 data "[210]un [198]ile 1.0","[196]atabase:","[204]en=","[212]ype:","[193]lpha","[203]ey","[206]um"
- 380 data "[211]pecial","[211]earching for field","[198]ile:","[212]otal="
- 390 data "[197]stimated # of records","[204]oading database parameters"
- 392 data " "
- 394 data "[211]elect fields in desired export order "
- 396 data "[211]ort (y/n)","[210]eplace record (y/n)","#recs"
- 400 rem set up screen
- 410 print"[147]":x=0:y=22:gosub2210
- 420 printcr$(ec);:for t=1 to sw:print"[192]";:next:x=0:gosub2210:printtx$(1);
- 430 x=0:y=23:gosub2210:printcm$;
- 440 rem get commands
- 450 c=1:gosub 5110
- 460 x=cx(c):y=cy(c):gosub2210:print""cr$(hc);cm$(c);"[146]";
- 470 geta$:ifa$=""then470
- 480 x=cx(c):y=cy(c):gosub2210:printcr$(cc);cm$(c);
- 490 ifa$=chr$(13)then660
- 500 ifa$=""then600
- 510 ifa$="[157]"then630
- 520 ifa$="c"then710
- 530 ifa$="e"then810
- 540 ifa$="n"then1110
- 550 ifa$="o"then1210
- 560 ifa$="u"then1610
- 570 ifa$="x"then1710
- 580 goto460
- 590 rem cursor right
- 600 c=c+1:ifc>ncthenc=1
- 610 goto460
- 620 rem cursor left
- 630 c=c-1:ifc<1thenc=nc
- 640 goto460
- 650 rem return
- 660 on c goto 710,810,1110,1210,1610,1710:goto470
- 700 rem close database
- 710 if of=0 then 450
- 715 open 1,dn,15,"i":print#1,"s:\\temp.i":close1
- 720 of=0:open 2,dn,2,"\\temp.i,u,w":nr=ix(0)
- 730 rh=fnh(nr):rl=fnl(nr):print#2,"indx";chr$(vn);chr$(rl);chr$(rh);
- 740 if nr=0 then 760
- 750 for t=1 to nr:rh=fnh(ix(t)):rl=fnl(ix(t)):print#2,chr$(rl);chr$(rh);:next
- 760 close2
- 770 open1,dn,15,"s:"+dn$+"bi":print#1,"r:"+dn$+"bi="+dn$+".i"
- 780 print#1,"r:"+dn$+".i=\\temp.i":close1
- 785 for t=1 to nl:fl$(t)="":next
- 790 goto 410
- 800 rem edit database
- 810 if of=0 then 1030
- 820 pd$=ul$:fc=1:nd=0:pl=tl
- 830 open1,dn,15:open3,dn,3,dn$+".d"
- 840 al=0:ky=0:nm=0:sp=0:gosub 5110:x=0:y=24:gosub2210:print tx$(4);
- 850 if ft(fc) and 1 then x=6:y=24:gosub 2210:print""+tx$(5)+"[146]";:al=1
- 860 if ft(fc) and 2 then x=12:y=24:gosub 2210:print""+tx$(6)+"[146]";:ky=1
- 870 if ft(fc) and 4 then x=16:y=24:gosub 2210:print""+tx$(7)+"[146]";:nm=1
- 880 if ft(fc) and 8 then x=20:y=24:gosub 2210:print""+tx$(8)+"[146]";:sp=1
- 885 x=sw-11:y=24:gosub 2210:print tx$(18);nr;
- 890 x=fx(fc):y=fy(fc):l=fl(fc):an$=ft$(fc)
- 900 print cr$(ec);
- 910 gosub 3430:t=fl(fc)-len(an$):ft$(fc)=an$+left$(pd$,t)
- 920 if a$=chr$(13) and fc=nf then 840
- 930 if a$="" or a$=chr$(13) then fc=fc+1:if fc>nf then fc=1
- 940 if a$="[145]" then fc=fc-1:if fc<1 then fc=nf
- 950 if ct=1 and asc(a$+chr$(0))=27 then a$=""
- 960 if a$="" then 1020
- 970 if a$=chr$(f1) then gosub 5310:fc=1:rem find rec
- 975 if a$=chr$(f2) then gosub 2110:fc=1:rem write rec
- 980 if a$=chr$(f3) then kf=1:gosub 1855:fc=1:rem first rec
- 985 if a$=chr$(f4) then kf=ix(0):gosub 1855:fc=1:rem last rec
- 990 if a$=chr$(f5) then gosub 1950:fc=1:rem read next
- 995 if a$=chr$(f6) then gosub 1850:fc=1:rem read prev
- 1000 if a$=chr$(f7) then gosub 4010:fc=1:rem clear form fields
- 1005 if a$=chr$(f8) then gosub 4060:fc=1:rem print form fields
- 1010 goto 840
- 1020 close3:close1
- 1030 gosub1696:goto430
- 1100 rem new database
- 1110 if of=1 then 450
- 1120 x=0:y=24:gosub2210:print tx$(2);:l=14:x=9:gosub 2320
- 1130 if a$="" then dn$="":goto 410
- 1140 if an$="" then 1120
- 1150 open 2,dn,2,an$+".f,u,r":gosub 5140:close2
- 1160 if en=0 then 1110
- 1170 if en<>62 then gosub 5060:goto 410
- 1180 nf=22:for t=1 to nf:fx(t)=0:fy(t)=t-1:fl(t)=sw-1:ft$(t)=left$(sp$,sw-2)+ss$
- 1190 x=fx(t):y=fy(t):gosub2210:print ft$(t);
- 1195 ft(t)=0:next:dn$=an$:gosub 2790:dn$="":goto 410
- 1200 rem open database
- 1210 if of=1 then 1500
- 1220 gosub 5110
- 1225 x=0:y=24:gosub2210:print tx$(2);:l=14:x=9:gosub 2320:if a$="" then 1500
- 1230 if an$="" then 1220
- 1240 open 2,dn,2,an$+".f,u,r":gosub 5140:close2:if en<>0 then 1220
- 1250 x=0:y=24:gosub2210:print tx$(13);
- 1260 tl=0:gosub 3310:if ef=-1 then 1220
- 1270 dn$=an$:open 2,dn,2,dn$+".i,u,r":gosub 5140:close2
- 1280 if en=0 then 1380
- 1290 if en<>62 then gosub 5060:goto 410
- 1300 rem create database
- 1310 gosub5110:x=0:y=24:gosub2210:print tx$(12);:l=4:x=23:gosub2320
- 1320 rn=val(an$):if rn=0 then 1310
- 1330 if rn>mr then rn=mr
- 1340 open 2,dn,2,dn$+".i,u,w":print#2,"indx";chr$(vn);chr$(0);chr$(0);:close2
- 1350 open1,dn,15:open3,dn,3,dn$+".d,l,"+chr$(tl):rh=fnh(rn):rl=fnl(rn)
- 1360 rp=1:gosub5010:print#3,chr$(255);:gosub 5010:close3:close1:gosub 5140
- 1370 rem read in database index,parms
- 1380 of=1:x=sw-22:y=22:gosub2210:printtx$(10);dn$;:t1=1
- 1390 for t=1 to nl:x=0:y=t-1:gosub 2210
- 1400 if ct=0 then print ft$(t);
- 1410 if ct=1 then print left$(ft$(t),sw-1);
- 1420 next:for t=1 to nf:t1=t1+fl(t):if(ft(t)and2)<>0 then kl=fl(t):kp=t1-kl:k1=t
- 1430 ft$(t)=left$(ul$,fl(t)):next:tl=t1-1
- 1440 open 2,dn,2,dn$+".i,u,r"
- 1450 get#2,a$,a$,a$,a$:get#2,a$:vn=asc(a$+chr$(0))
- 1460 get#2,a$,b$:nr=asc(a$+chr$(0))+(asc(b$+chr$(0))*256):ix(0)=nr
- 1470 if nr=0 then 1490
- 1480 for t=1 to nr:get#2,a$,b$:ix(t)=asc(a$+chr$(0))+(asc(b$+chr$(0))*256):next
- 1490 close2
- 1500 goto450
- 1600 rem utils database
- 1610 gosub 4210:goto 430
- 1612 rem select fields
- 1615 if of=0 then return
- 1620 pd$=sp$:fc=1:so=1:for t=1 to nf:fq(t)=0:fo(t)=0:next
- 1622 if fr=2 then x=0:y=23:gosub 2210:print"[211]elect field to search on ";:goto 1630
- 1625 x=0:y=23:gosub 2210:print tx$(15);
- 1630 an$=ft$(fc):l=fl(fc):x=fx(fc):y=fy(fc)
- 1632 if fr=0 or fr=2 then 1638
- 1633 get a$:if a$="" then 1633
- 1634 if ct=1 and asc(a$+chr$(0))=27 then a$=""
- 1635 if a$="" then return
- 1636 goto 1633
- 1638 printcr$(ec);:gosub5200:printcr$(cc);
- 1640 if a$=chr$(13) and fq(fc)=0 then fq(fc)=so:fo(so)=fc:so=so+1:if fr=2 then fr=1
- 1645 if a$="" or a$=chr$(13) then fc=fc+1:if fc>nf then fc=1
- 1650 if a$="[145]" then fc=fc-1:if fc<1 then fc=nf
- 1655 if ct=1 and asc(a$+chr$(0))=27 then a$=""
- 1657 if a$="" then return
- 1659 goto 1630
- 1660 rem make usr file
- 1662 gosub5110:x=0:y=24:gosub 2210:print tx$(16);:l=1:y=24:x=11:gosub 2320
- 1665 if an$="n" or an$="[206]" or an$="y" or an$="[217]" then 1675
- 1667 goto 1660
- 1670 rem build output records
- 1675 gosub 6010
- 1680 rem sort records
- 1685 if an$="y" or an$="[217]" then gosub 7010
- 1690 rem output export file
- 1691 if c=4 then gosub 8310
- 1692 if c=5 then gosub 8210
- 1695 if c=6 then gosub 8010
- 1696 for t=1 to nf
- 1697 ft$(t)=left$(ul$,fl(t)):x=fx(t):y=fy(t):gosub2210:print cr$(cc);ft$(t);
- 1698 next
- 1699 an$="":return
- 1700 rem exit program
- 1710 if of=1 then 450
- 1720 if ct=0 then poke 808,237:goto1730
- 1721 (NULL) 1,"graphic":(NULL) 2,"dload"+chr$(34):(NULL) 3,"directory"+chr$(13)
- 1722 (NULL) 4,"scnclr"+chr$(13):(NULL) 5,"dsave"+chr$(34):(NULL) 6,"run"+chr$(13)
- 1723 (NULL) 7,"list"+chr$(13):(NULL) 8,"monitor"+chr$(13)
- 1730 print"[147][154]"
- 1740 end
- 1750 rem read record
- 1760 t8=fl(fc)-len(an$):ft$(k1)=an$+left$(ul$,t8):ky$=an$:gosub 2550
- 1770 if kf<1 then 1830
- 1780 rp=1:gosub 5010:r$="":r1$=""
- 1790 for t=1 to tl:get#3,a$:r$=r$+a$:next:gosub 5010
- 1800 a=1:for t=1 to nf
- 1810 ft$(t)=mid$(r$,a,fl(t)):a=a+fl(t)
- 1815 x=fx(t):y=fy(t):gosub2210:print cr$(ec);ft$(t);
- 1820 next
- 1830 return
- 1840 rem read prev record
- 1850 kf=kf-1:if kf<1 then kf=ix(0)
- 1855 rn=ix(kf):if rn=0 then kf=0
- 1860 goto 1770
- 1940 rem read next record
- 1950 kf=kf+1:rn=ix(kf):if rn=0 then kf=1:rn=ix(kf):if rn=0 then kf=0
- 1960 goto 1770
- 2100 rem write record
- 2110 if nr=mr then 2170
- 2120 ky$=ft$(k1):gosub 2550
- 2130 if kf<1 then gosub 2710:nr=ix(0)
- 2140 rp=1:gosub5010
- 2150 r$="":r1$="":for t=1 to nf:r$=r$+ft$(t)
- 2155 ft$(t)=left$(ul$,fl(t)):x=fx(t):y=fy(t):gosub2210:print ft$(t);
- 2157 next:gosub 5110
- 2158 an$="y":if kf>0 then x=0:y=24:gosub 2210:print tx$(17);:x=22:l=1:gosub2320
- 2160 if an$="y" or an$="[217]" then print#3,r$;
- 2170 gosub 5010:return
- 2200 rem cursor plot
- 2210 if ct=0 then print"";left$(xp$,x);left$(yp$,y);:return
- 2220 if ct=1 then print"";left$(xp$,x);left$(yp$,y);:return
- 2250 rem cursor read
- 2260 if ct=0 then x=peek(211):y=peek(214)
- 2270 if ct=1 then poke 5,1:sys 65520:y=peek(7):x=peek(8)
- 2280 if x>=sw then x=x-sw
- 2290 return
- 2300 rem requestor editor
- 2310 rem pass x,y,l=length returns an$
- 2320 an$="":gosub2210:print""left$(sp$,l)"[146]";:gosub2210
- 2330 get a$:if a$="" then 2330
- 2340 a=asc(a$)
- 2350 if ct=1 and a=27 then a$=""
- 2360 if a$="" then return
- 2370 ifa<>13then2390
- 2380 gosub2200:printan$;left$(sp$,(l+1)-len(an$));:return
- 2390 ifa=20andlen(an$)>0thengosub2450
- 2400 ifa=147andlen(an$)>0thengosub2450:goto2320
- 2410 ifa<31ora>218then2330
- 2420 ifa>90anda<193then2330
- 2430 iflen(an$)>=lthen2330
- 2440 printa$;:an$=an$+a$:goto2330
- 2450 a$=" [146][157]":iflen(an$)>=lthena$=" [157]"
- 2460 if ct=0 then printa$;"[157] [146][157]";
- 2470 if ct=1 then print"[157] [146][157]";
- 2480 an$=left$(an$,len(an$)-1):return
- 2490 rem binary search
- 2500 rem pass ky$=key string:kl=key len
- 2510 rem os=offset into record for key
- 2520 rem return kf=key found 0=no 1=yes
- 2530 rem -1=search error
- 2540 rem rn=record# ip=insert position
- 2550 rem
- 2560 rs=1:re=ix(0):kf=0:ip=0:if re<rs then ip=1:return
- 2570 rm=int(re/2):if rm=0 then rm=1
- 2580 rn=ix(rm):rp=kp:gosub 5010
- 2590 r$="":for t=1 to kl:get#3,a$:r$=r$+a$:next
- 2600 if ky$=left$(r$,len(ky$)) then kf=rm:return
- 2610 if re<=rs then ip=re:kf=0:rn=ix(ip+1):gosub 2640:return
- 2620 if ky$>r$ then rs=rm+1:rm=int((re-rs)/2)+rs:goto 2580
- 2630 if ky$<r$ then re=rm-1:rm=int((re-rs)/2)+rs:goto 2580
- 2640 if rn=0 or rn>mr then r1$="":return
- 2650 rp=kp:gosub5010
- 2660 r1$="":for t=1 to kl:get#3,a$:r1$=r1$+a$:next:return
- 2670 kf=-1:return:rem search error
- 2680 rem insert key into index
- 2690 rem ip=insert position r$=record string r1$=next record string
- 2700 rem ky$=key string rn=record#
- 2710 ix(0)=ix(0)+1:if ix(0)=1 then ip=1:goto 2760
- 2720 if ky$<r$ then 2750
- 2730 if ky$<r1$ then ip=ip+1:goto 2750
- 2740 ip=ix(0):goto 2760
- 2750 for t=ix(0) to int(ip+1)step-1:ix(t)=ix(t-1):next
- 2760 ix(ip)=ix(0):rn=ix(0)
- 2770 return
- 2780 rem form maker
- 2790 pd$=sp$:fc=1:nd=1:tl=0:tf=0:gosub 5110
- 2800 x=fx(fc):y=fy(fc):l=fl(fc):an$=ft$(fc)
- 2810 gosub 3430:t=fl(fc)-len(an$):ft$(fc)=an$+left$(pd$,t)
- 2820 if a$="" or a$=chr$(13) then fc=fc+1:if fc>nf then fc=1
- 2830 if a$="[145]" then fc=fc-1:if fc<1 then fc=nf
- 2840 if ct=1 and asc(a$+chr$(0))=27 then a$=""
- 2850 if a$="" then 2880
- 2860 goto 2800
- 2870 rem review form & set field vars
- 2880 gosub 5110:x=0:y=24:gosub2210:print tx$(9);
- 2890 nd=1:fc=0:al=0:nm=0:sp=0:ky=0:for ty=1 to nf
- 2900 x=0:y=ty-1:gosub2210:printft$(ty);
- 2910 ef=0:if right$(ft$(ty),1)=ss$ then ef=-1
- 2920 ft$(ty)=ft$(ty)+" ":if ef=-1 then ef=0:goto 3190
- 2930 for tx=1 to l+1
- 2940 a$=mid$(ft$(ty),tx,1)
- 2950 if a$<>"[164]" then 3000
- 2960 if nd=2 then 2980
- 2965 if fc=mf then 3180
- 2970 fc=fc+1:nd=2:fl(fc)=0:fx(fc)=tx-1:fy(fc)=ty-1:x=tx-1:y=ty-1:gosub2210
- 2980 fl(fc)=fl(fc)+1:print"[164][146]";
- 2990 goto 3180
- 3000 if nd=1 then 3180
- 3010 nd=1:x=0:y=24:gosub2210
- 3020 print tx$(4)+" "+tx$(5)+" "+tx$(6)+" "+tx$(7)+" "+tx$(8);
- 3030 get a$:if a$="" then 3030
- 3040 if ct=1 and asc(a$)=27 then a$=""
- 3050 if a$="" then ft(fc)=al+((ky and 1)*2)+(nm*4)+(sp*8):al=0:nm=0:sp=0:goto 3160
- 3060 if a$="a" and al=0 then al=1:x=6:gosub2210:print""+tx$(5)+"[146]";:goto 3080
- 3070 if a$="a" and al=1 then al=0:x=6:gosub2210:printtx$(5);
- 3080 if a$="k" and ky=0 then ky=1:x=12:gosub2210:print""+tx$(6)+"[146]";:goto 3120
- 3090 if a$="k" and ky=1 then ky=0:x=12:gosub2210:printtx$(6);
- 3100 if a$="n" and nm=0 then nm=1:x=16:gosub2210:print""+tx$(7)+"[146]";:goto 3120
- 3110 if a$="n" and nm=1 then nm=0:x=16:gosub2210:printtx$(7);
- 3120 if a$="s" and sp=0 then sp=1:x=20:gosub2210:print""+tx$(8)+"[146]";:goto 3140
- 3130 if a$="s" and sp=1 then sp=0:x=20:gosub2210:printtx$(8);
- 3140 rem
- 3150 goto 3030
- 3160 gosub 5110:x=0:y=24:gosub2210:print tx$(9);
- 3170 if ky=1 then ky=2
- 3180 next tx
- 3190 next ty
- 3200 gosub 5110:if ky=0 then ft(1)=ft(1)or2
- 3210 rem write form to disk
- 3220 open 2,dn,2,dn$+".f,u,w"
- 3230 print#2,"form";chr$(vn);chr$(sw);chr$(nf);
- 3240 for t=1 to nf:print#2,ft$(t);:next
- 3250 print#2,chr$(fc);
- 3260 for t=1 to fc:print#2,chr$(fx(t));chr$(fy(t));chr$(fl(t));chr$(ft(t));
- 3270 next
- 3280 close2
- 3290 return
- 3300 rem read form from disk
- 3310 open 2,dn,2,an$+".f,u,r"
- 3320 get#2,a$,a$,a$,a$:get#2,a$:vn=asc(a$+chr$(0))
- 3330 get#2,a$:a=asc(a$+chr$(0)):if sw=40 and a=80 then close2:ef=-1:return
- 3340 get#2,a$:nl=asc(a$+chr$(0))
- 3350 for t=1 to nl:ft$(t)="":for t1=1 to a:get#2,a$:ft$(t)=ft$(t)+a$:next
- 3355 fl$(t)=ft$(t):next
- 3360 get#2,a$:nf=asc(a$+chr$(0))
- 3370 for t=1 to nf:get#2,a$:fx(t)=asc(a$+chr$(0))
- 3380 get#2,a$:fy(t)=asc(a$+chr$(0)):get#2,a$:fl(t)=asc(a$+chr$(0)):tl=tl+fl(t)
- 3390 get#2,a$:ft(t)=asc(a$+chr$(0)):next
- 3400 close2:ef=0:return
- 3410 rem form field editor
- 3420 rem pass x,y,l=length returns an$
- 3430 gosub2210:print""+left$(an$,l)+"[146]";:gosub2210:an$="":ox=x:oy=y
- 3440 get a$:if a$="" then 3440
- 3450 a=asc(a$):if a=f1 or a=f2 then3460
- 3455 if a>=f3 and a<=f8 then 3480
- 3460 if ct=1 and a=27 then a$=""
- 3470 if a$<>"" and a$<>"[145]" and a$<>""then 3490
- 3480 x=ox:y=oy:an$=ft$(fc):gosub2210:printan$;:tl=pl:return
- 3490 if a$="" and nd<>0 and tf<mf then gosub3730:goto3440
- 3491 if a$="" and nd<>0 then 3493
- 3492 goto 3500
- 3493 b$="":for t2=1 to sw-1:a$=mid$(ft$(fc),t2,1):if a$="[164]" then tl=tl-1
- 3494 if a$<>"[164]" and b$="[164]" then tf=tf-1
- 3495 b$=a$:next:pl=tl:x=0:gosub2210:ft$(fc)=left$(sp$,sw-1):an$=ft$(fc)
- 3496 goto 3430
- 3500 if a=f1 or a=f2 then 3510
- 3505 ifa<>13then3550
- 3510 x=ox:y=oy
- 3520 pl=tl:gosub2210
- 3530 if ct=0 then printan$;left$(pd$,l-len(an$));:return
- 3540 if ct=1 then printan$;left$(pd$,l-len(an$));:return
- 3550 ifa=20andlen(an$)>0thengosub3670
- 3560 if nd<>0 then 3630
- 3570 if a=32 then 3650
- 3580 if a=34 then 3440
- 3590 if al=1 then if (a and 127) > 64 and (a and 127) < 91 then goto 3650
- 3600 if nm=1 then if a>39 and a<58 then 3650
- 3610 if sp=1 then if(a>31 and a<48)or(a>57 and a<65)or(a>90 and a<96) then 3650
- 3620 goto 3440
- 3630 ifa<32ora>218then3440
- 3640 ifa>95anda<193then3440
- 3650 iflen(an$)>=lthen3440
- 3660 printa$;:an$=an$+a$:goto3440
- 3670 if mid$(an$,len(an$),1) = "[164]" then return
- 3680 a$="":rem a$=" [146][157]":iflen(an$)>=lthena$=" [157]"
- 3690 if ct=0 then printa$;"[157] [146][157]";
- 3700 if ct=1 then print"[157] [146][157]";
- 3710 an$=left$(an$,len(an$)-1):return
- 3720 rem field definer
- 3730 nd=2:fl=0
- 3740 gosub2260:tx=x:ty=y
- 3750 gosub 5110:x=0:y=24:gosub2210:print tx$(3);fl;tx$(11);tl;
- 3760 x=tx:y=ty:gosub 2210
- 3770 get a$:if a$="" then 3770
- 3780 a=asc(a$)
- 3790 if a$<>"" then 3810
- 3795 if fl>0 then tf=tf+1
- 3800 nd=1:tx=x:ty=y:gosub 5110:x=tx:y=ty:gosub 2210:return
- 3810 if a=20 and fl>0 then gosub 3870
- 3820 if a$<>" " then 3740
- 3830 iflen(an$)>=lthen3770
- 3840 if tl>253 then 3770
- 3850 if mid$(ft$(fc),x+1,1)="[164]" then tl=tl-1
- 3860 a$="[164]":print a$;:an$=an$+a$:fl=fl+1:tl=tl+1:goto3740
- 3870 fl=fl-1:tl=tl-1:a$=" [146][157]":iflen(an$)>=lthena$=" [157]"
- 3880 if ct=0 then printa$;"[157] [146][157]";
- 3890 if ct=1 then print"[157] [146][157]";
- 3900 an$=left$(an$,len(an$)-1):return
- 4000 rem clear fields
- 4010 for t=1 to nf
- 4020 ft$(t)=left$(ul$,fl(t)):x=fx(t):y=fy(t):gosub2210:print ft$(t);:next
- 4030 return
- 4050 rem print fields
- 4060 open4,4,7
- 4065 h2=1:for h=1 to nl
- 4070 for h1=1 to len(fl$(h)):a$=mid$(fl$(h),h1,1)
- 4080 if a$<>"[164]" then print#4,a$;:goto 4100
- 4082 for h3=1 to fl(h2):a$=mid$(ft$(h2),h3,1)
- 4083 if a$="[164]" then a$=" "
- 4085 print#4,a$;:next:h2=h2+1
- 4090 h1=h1+1:a$=mid$(fl$(h),h1,1):if a$="[164]" then 4090
- 4095 h1=h1-1
- 4100 next
- 4105 print#4,chr$(13);:next
- 4110 close4:return
- 4200 rem utils sub menu
- 4210 x=0:y=23:gosub 2210:printleft$(sp$,sw);
- 4215 x=0:y=24:gosub 2210:printleft$(sp$,sw-1);
- 4220 x=0:y=23:gosub 2210:print sm$;
- 4230 c=1
- 4235 x=sx(c):y=sy(c):gosub 2210:print""cr$(hc);sm$(c);"[146]";
- 4240 geta$:ifa$=""then4240
- 4245 x=sx(c):y=sy(c):gosub2210:printcr$(cc);sm$(c);
- 4250 if a$=chr$(13) then4300
- 4255 if a$="" then 4270
- 4260 if a$="[157]" then 4280
- 4261 if ct=1 and a$=chr$(27) then a$=""
- 4262 if a$="" then return
- 4265 goto 4235
- 4270 c=c+1:if c>ns then c=1
- 4275 goto 4235
- 4280 c=c-1:if c<1 then c=ns
- 4285 goto 4235
- 4300 on c goto 4410,4510,4610,4710,4810,4810
- 4305 goto 4235
- 4400 rem dir
- 4410 if ct=0 then 4460
- 4420 print"[147]":(NULL) u(dn)
- 4422 print"[208]ress [210][197][212][213][210][206] to continue"
- 4423 geta$:if a$<>chr$(13) then 4423
- 4424 print"[147]";
- 4430 for t=1 to nl:print fl$(t):next
- 4431 x=0:y=22:gosub2210
- 4432 printcr$(ec);:for t=1 to sw:print"[192]";:next:x=0:gosub2210:printtx$(1);
- 4440 goto 4215
- 4450 rem c64 dir
- 4460 print"[147]":gosub 10000
- 4490 goto 4422
- 4500 rem dos
- 4510 x=0:y=24:l=30:gosub2320:if a$="" then goto 4210
- 4520 open 1,dn,15,an$:close1:gosub 5060
- 4530 goto 4215
- 4600 rem drive#
- 4610 x=0:y=24:l=2:gosub 2320:a=val(an$):if a>7 and a<12 then dn=a
- 4615 a$="[196]rive#":b$="":if dn<10 then b$="0"
- 4616 b$=b$+mid$(str$(dn),2)
- 4620 sm$(c)=a$+b$
- 4630 a$=sm$:sm$=left$(a$,23)+b$+mid$(a$,26)
- 4650 goto 4215
- 4700 rem print
- 4710 rt=0:gosub 5110:x=0:y=24:gosub 2210:print"[210]eport or [204]abels ? (r/l)";
- 4711 x=26:y=24:l=1:gosub 2320
- 4712 if an$="r" then rt=1
- 4713 if an$="l" then rt=2
- 4715 if rt=0 then 4710
- 4719 gosub 1615:if of=0 then 4215
- 4720 gosub 1662:goto 4215
- 4800 rem seq,usr
- 4810 gosub 1615:if of=0 then 4215
- 4820 gosub 1662:goto 4215
- 5000 rem position to record#
- 5010 rh=fnh(rn):rl=fnl(rn)
- 5020 print#1,"p"chr$(96+3)chr$(rl)chr$(rh)chr$(rp)
- 5030 print#1,"p"chr$(96+3)chr$(rl)chr$(rh)chr$(rp)
- 5040 return
- 5050 rem general disk error alert
- 5060 gosub 5110:x=0:y=24:gosub2210:print en;" ";er$;tr;sc;" [208]ress [210][197][212][213][210][206]";
- 5070 get a$:if a$="" then 5070
- 5080 if a$<>chr$(13) then 5070
- 5090 close1:close2:close3:return
- 5100 rem clear status line
- 5110 x=0:y=24:gosub2210:print left$(sp$,sw-1);:return
- 5120 x=0:y=23:gosub2210:print left$(sp$,sw-1);:return
- 5130 rem disk status reader
- 5140 open1,dn,15
- 5145 input#1,en,er$,tr,sc:close1
- 5150 return
- 5200 gosub2210:print""+left$(an$,l)+"[146]";
- 5210 get a$:if a$="" then 5210
- 5220 a=asc(a$)
- 5230 if ct=1 and a=27 then a$=""
- 5240 if a$<>"" and a$<>"[145]" and a$<>"" and a$<>chr$(13) then 5210
- 5250 if a$=chr$(13) then return
- 5255 if fq(fc)<>0 then return
- 5260 gosub2210:printcr$(cc);left$(an$,l);:return
- 5300 rem find record
- 5310 fr=2:gosub 5110:gosub 1615:fc=fo(1):fr=0:if fc=0 then return
- 5315 gosub5120:gosub 2210:print "[197]nter search string";
- 5320 l=fl(fc):x=0:y=24:gosub 2320
- 5330 if ft(fc) and 2 then gosub 1760:gosub 5120:return
- 5350 t1=1:t2=1:t5=len(an$)
- 5360 if t1=fc then 5400
- 5370 t2=t2+fl(t1):t1=t1+1:goto 5360
- 5400 t4=fl(fc):rn=0
- 5405 rn=rn+1:if rn>ix(0) then gosub5120:return
- 5410 rp=t2:gosub 5010:zz$=""
- 5420 for t3=1 to t4:get#3,a$:zz$=zz$+a$:next
- 5430 if left$(zz$,t5)=an$ then 5440
- 5432 get a$
- 5434 if ct=1 and asc(a$+chr$(0))=27 then a$=""
- 5435 if a$="" then gosub 5120:return
- 5437 goto 5405
- 5440 gosub 1780:gosub 5120
- 5445 x=0:y=23:gosub 2210:print "[210][197][212][213][210][206] - next rec [197][211][195] or [211][212][207][208] - exit";
- 5450 get a$:if a$="" then 5450
- 5460 if asc(a$)=27 then a$=""
- 5470 if a$="" then gosub 5120:return
- 5475 if a$=chr$(f8) then gosub 4060:goto 5450
- 5480 if asc(a$)=13 then 5405
- 5490 goto 5450
- 6000 rem build output records
- 6010 open1,dn,15:open3,dn,3,dn$+".d":t1=1
- 6020 if t1>ix(0) then 6990
- 6030 rn=ix(t1):rp=1:gosub 5010:r$="":r1$=""
- 6040 for t=1 to tl:get#3,a$:r$=r$+a$:next:gosub 5010
- 6050 a=1:for t=1 to nf
- 6060 ft$(t)=mid$(r$,a,fl(t)):a=a+fl(t)
- 6070 next
- 6100 r$=""
- 6110 for t=1 to so-1
- 6120 r$=r$+ft$(fo(t))
- 6130 next
- 6140 rd$(t1)=r$:si(t1)=t1:t1=t1+1:goto 6020
- 6990 t1=t1-1:close3:close1:return
- 7000 rem sort output records
- 7010 for j=1 to t1-1
- 7020 for k=j+1 to t1
- 7030 if rd$(si(j)) > rd$(si(k)) then te=si(j):si(j)=si(k):si(k)=te
- 7040 next k
- 7050 next j
- 7990 return
- 8000 rem write output records to usr file
- 8010 open1,dn,15:open2,dn,2,dn$+".u,u,w":input#1,en,er$,tr,sc
- 8012 if en<>63 then 8020
- 8014 x=0:y=24:gosub 2210:print"[210]eplace file (y/n)";
- 8015 x=19:l=1:gosub 2320
- 8016 if an$="y" or an$="[217]" then print#1,"s:"+dn$+".u":close2:close1:goto 8010
- 8020 if en<>0 then close2:close1:gosub 5060:return
- 8025 rh=fnh(t1):rl=fnl(t1)
- 8027 print#2,"qury";
- 8031 print#2,chr$(vn);chr$(rl);chr$(rh);
- 8040 print#2,chr$(so-1);:for t=1 to so-1:print#2,chr$(fl(fo(t)));:next
- 8050 for t=1 to t1:print#2,rd$(si(t));:next
- 8100 close2:close1
- 8110 return
- 8200 rem write output records to seq file
- 8210 open1,dn,15:open2,dn,2,dn$+".s,s,w":input#1,en,er$,tr,sc
- 8212 if en<>63 then 8220
- 8214 x=0:y=24:gosub 2210:print"[210]eplace file (y/n)";
- 8215 x=19:l=1:gosub 2320
- 8216 if an$="y" or an$="[217]" then print#1,"s:"+dn$+".s":close2:close1:goto 8210
- 8220 if en<>0 then close2:close1:gosub 5060:return
- 8250 for t=1 to t1:t5=1
- 8252 for t4=1 to so-1:t7=fl(fo(t4))
- 8254 for t8=0 to t7-1
- 8255 a$=mid$(rd$(si(t)),t5+t8,1):if a$="[164]" then a$=" "
- 8257 print#2,a$;:next:t5=t5+t7:print#2
- 8259 next:print#2:next
- 8260 close2:close1
- 8270 return
- 8300 rem write output records to printer
- 8310 if rt=2 then 8410
- 8320 open4,4,7
- 8350 for t=1 to t1:t5=1:t6=1
- 8352 for t4=1 to so-1:t7=fl(fo(t4)):if t6+t7>79 then print#4:t6=1
- 8354 for t8=0 to t7-1
- 8355 a$=mid$(rd$(si(t)),t5+t8,1):if a$="[164]" then a$=" "
- 8357 print#4,a$;:next:t5=t5+t7:t6=t6+t7+1:print#4," ";
- 8358 next:print#4:next
- 8360 close4
- 8370 return
- 8400 rem write output records to labels on printer
- 8410 open4,4,7
- 8450 for t=1 to t1:t6=0:t5=fy(fo(1)):t9=1
- 8452 for t4=1 to so-1:t7=fl(fo(t4)):if t5<>fy(fo(t4)) then print#4:t6=t6+1
- 8453 t5=fy(fo(t4))
- 8454 for t8=0 to t7-1
- 8455 a$=mid$(rd$(si(t)),t9+t8,1):if a$="[164]" then a$=" "
- 8457 print#4,a$;:next:print#4," ";:t9=t9+t7
- 8458 next
- 8459 if t6<7 then print#4:t6=t6+1:goto 8459
- 8460 next:close4
- 8990 return
- 10000 open1,dn,0,"$"
- 10010 get#1,a$,a$:t=2
- 10020 get#1,a$:if st<>0 then 10060
- 10030 get#1,a$,a$,b$:a=asc(b$+chr$(0))*256+asc(a$+chr$(0)):printa;:t=t+4
- 10040 get#1,a$:printa$;:t=t+1
- 10042 getc$:if c$<>" " then 10045
- 10043 poke 198,0
- 10044 getc$:if c$<>" " then 10044
- 10045 if t<32 then 10040
- 10050 t=0:print"[146]":goto 10020
- 10060 close1
- 10160 return
- 20000 open1,8,15,"s0:runfile":close1
- 20010 save"runfile",8
- 20020 end
- 21000 rem resume
-